home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / slib / tk / demos / mkListbox3.tcl < prev    next >
Text File  |  1994-09-20  |  2KB  |  35 lines

  1. # mkListbox3 w
  2. #
  3. # Create a top-level window containing a listbox with a bunch of well-known
  4. # sayings.  The listbox can be scrolled or scanned in two dimensions.
  5. #
  6. # Arguments:
  7. #    w -    Name to use for new top-level window.
  8.  
  9. proc mkListbox3 {{w .l3}} {
  10.     catch {destroy $w}
  11.     toplevel $w
  12.     dpos $w
  13.     wm title $w "Listbox Demonstration (well-known sayings)"
  14.     wm iconname $w "Listbox"
  15.     wm minsize $w 1 1
  16.     message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
  17.         -text "The listbox below contains a collection of well-known sayings.  You can scan the list using either of the scrollbars or by dragging in the listbox window with button 2 pressed.  Click the \"OK\" button when you're done."
  18.     frame $w.frame -borderwidth 10
  19.     button $w.ok -text OK -command "destroy $w"
  20.     pack $w.msg -side top
  21.     pack $w.ok -side bottom -fill x
  22.     pack $w.frame -side top -expand yes -fill y
  23.  
  24.     scrollbar $w.frame.yscroll -relief sunken -command "$w.frame.list yview"
  25.     scrollbar $w.frame.xscroll -relief sunken -orient horizontal \
  26.         -command "$w.frame.list xview"
  27.     listbox $w.frame.list -geometry 20x10 -yscroll "$w.frame.yscroll set" \
  28.         -xscroll "$w.frame.xscroll set" -relief sunken -setgrid 1
  29.     pack $w.frame.yscroll -side right -fill y
  30.     pack $w.frame.xscroll -side bottom -fill x
  31.     pack $w.frame.list -expand yes -fill y
  32.  
  33.     $w.frame.list insert 0 "Waste not, want not" "Early to bed and early to rise makes a man healthy, wealthy, and wise" "Ask not what your country can do for you, ask what you can do for your country" "I shall return" "NOT" "A picture is worth a thousand words" "User interfaces are hard to build" "Thou shalt not steal" "A penny for your thoughts" "Fool me once, shame on you;  fool me twice, shame on me" "Every cloud has a silver lining" "Where there's smoke there's fire" "It takes one to know one" "Curiosity killed the cat" "Take this job and shove it" "Up a creek without a paddle" "I'm mad as hell and I'm not going to take it any more" "An apple a day keeps the doctor away" "Don't look a gift horse in the mouth"
  34. }
  35.